class TimelinePluginRegistersController < ApplicationController
  # GET /timeline_plugin_registers
  # GET /timeline_plugin_registers.xml
  def index
     @timeline_plugin_registers = TimelinePluginRegister.all.paginate(:page => params[:page],:per_page =>3)
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @timeline_plugin_registers }
    end
  end

  # GET /timeline_plugin_registers/1
  # GET /timeline_plugin_registers/1.xml
  def show
    @timeline_plugin_register = TimelinePluginRegister.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @timeline_plugin_register }
    end
  end

  # GET /timeline_plugin_registers/new
  # GET /timeline_plugin_registers/new.xml
  def new
    @timeline_plugin_register = TimelinePluginRegister.new
    @timeline_plugin_register.bottom_pixels = 100
    @timeline_plugin_register.top_pixels = 75
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @timeline_plugin_register }
    end
  end

  # GET /timeline_plugin_registers/1/edit
  def edit
    @timeline_plugin_register = TimelinePluginRegister.find(params[:id])
  end

  # POST /timeline_plugin_registers
  # POST /timeline_plugin_registers.xml
  def create
    @timeline_plugin_register = TimelinePluginRegister.new(params[:timeline_plugin_register])
    @timeline_plugin_register.owner_user_id=000

     @timeline_plugin_register.timeline_js = TimelinePluginRegister.sanitize( @timeline_plugin_register.timeline_js)
    respond_to do |format|
      if @timeline_plugin_register.save
        flash[:notice] = 'TimelinePluginRegister was successfully created.'
        format.html { redirect_to(@timeline_plugin_register) }
        format.xml  { render :xml => @timeline_plugin_register, :status => :created, :location => @timeline_plugin_register }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @timeline_plugin_register.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /timeline_plugin_registers/1
  # PUT /timeline_plugin_registers/1.xml
  def update
    @timeline_plugin_register = TimelinePluginRegister.find(params[:id])

    respond_to do |format|
      if @timeline_plugin_register.update_attributes(params[:timeline_plugin_register])
        flash[:notice] = 'TimelinePluginRegister was successfully updated.'
        format.html { redirect_to(@timeline_plugin_register) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @timeline_plugin_register.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /timeline_plugin_registers/1
  # DELETE /timeline_plugin_registers/1.xml
  def destroy
    @timeline_plugin_register = TimelinePluginRegister.find(params[:id])
    @timeline_plugin_register.destroy

    respond_to do |format|
      format.html { redirect_to(timeline_plugin_registers_url) }
      format.xml  { head :ok }
    end
  end
end
